/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package OLD;

import com.sun.lwuit.Button;
import com.sun.lwuit.Container;
import com.sun.lwuit.Image;
import com.sun.lwuit.Label;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.TextField;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BoxLayout;
import java.io.IOException;

/**
 *
 * @author nialldeasy
 */
public class Reader extends Menu{

        public Reader(String Name,String prevMenu,ActionListener a){

        super(Name,"paper.jpg",a);
        setBackCommand("Main Menu");
        addCommand(prevMenu);
        setLayoutType(2);
        //.....................add Image for text file if available......//
        try {
            Label image = new Label(Image.createImage("/images/"+Name+".jpg"));
            if(image!=null){
            image.setGap(10);
            this.add(image);
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        //......................add text file...........................//

            addText("This is a sample file reader enter read text from file here");

        //......................................................................//


        }


        public void addText(String text){
            TextArea t =new TextArea(text);
            t.setEditable(false);
            this.add(t);
        }

        public void addButtons(ActionListener a,String prev){
            Container buttonBar = new Container(new BoxLayout(BoxLayout.X_AXIS));
            buttonBar.setPreferredH(5);
            buttonBar.addComponent(createButton("Main Menu"));
            buttonBar.addComponent(createButton(prev));
           // buttonBar.addComponent(createButton("Exit"));
            this.add(buttonBar);
        }

        public Button createButton(String Name){
            Button b = new Button(Name);
            b.setUIID(Name);
            b.setText(Name);
            b.setAlignment(Label.CENTER);
            b.setTextPosition(Label.BOTTOM);
            b.setFocusable(true);
           // b.setHeight(10);
            b.addActionListener(a);
           // b.setFocusPainted(false);
            return b;
        }
}
